import time
import unittest
from interfaceFramework.Commonlib.HTMLTestRunner import HTMLTestRunner
from interfaceFramework.testCast.Login import loginTest
from interfaceFramework.testCast.Login2 import loginTest2


# 封装测试套件
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(loginTest))
suite.addTest(unittest.makeSuite(loginTest2))

# 指定报告路径
report = "../report/report-{}.html".format(time.strftime("%Y%m%d-%H%M%S"))

#  打开文件流 ,可以写入的
with open(report, "wb") as f:
    # 创建HTMLTestRunner运行器
    runner = HTMLTestRunner(f, title="接口测试报告")
    # 执行测试套件
    runner.run(suite)
